package com.ltu.model.request.alidto.req;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ltu.common.Constants;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.apache.commons.lang3.StringUtils;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * 创建直播间请求参数
 * @author chunlei.zcl
 */
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "创建直播间请求参数")
public class RoomCreateRequestDto {
    @ApiModelProperty(value = "直播标题")
    @NotBlank(message="title不能为空")
    private String title;

    @ApiModelProperty(value = "直播公告")
    private String notice;
    
	@ApiModelProperty(value = "直播封面")
	@NotBlank(message="coverUrl不能为空")
	private String coverUrl;
    
	@ApiModelProperty(value = "群组Id")
	private String chatId;
	
	@ApiModelProperty(value = " 主播Id")
	private String anchorId;
	
    @ApiModelProperty(value = "主播名称",hidden = true)
    private String anchor;
    
    @ApiModelProperty(value = "主播nick")
    private String anchorNick;
	/**
	 * 直播开始时间
	 */
	@ApiModelProperty(value = "直播开始时间")
	@NotNull(message="startedAt不能为空")
	private Date startedAt;
	/**
	 * 直播结束时间
	 */
	@ApiModelProperty(value = "直播结束时间")
	@NotNull(message="stoppedAt不能为空")
	private Date stoppedAt;

    @ApiModelProperty(value = "模式，默认0 普通直播，1 连麦直播")
    @JsonIgnore
    private Long mode = 0L;

    @ApiModelProperty(value = "扩展字段, json格式")
    private String extendsInfo;

    @JsonIgnore
    @ApiModelProperty(value = "im群列表")
    private List<String> imServer;
	 @ApiModelProperty(value = "点赞数")
		private Integer likeAmount; 
	 @ApiModelProperty(value = "统计增量")
	 private Integer viewingIncre; 
	 @ApiModelProperty(value = "在线人数")
	 private Integer onlineNum; 
	 

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	

	public String getNotice() {
		return notice;
	}

	public void setNotice(String notice) {
		this.notice = notice;
	}

	public String getAnchor() {
		if(StringUtils.isBlank(this.anchor))
			this.anchor= UUID.randomUUID().toString().replaceAll("-", "");
		return anchor;
	}

	public void setAnchor(String anchor) {
		this.anchor = anchor;
	}

	public String getAnchorNick() {
		return anchorNick;
	}

	public void setAnchorNick(String anchorNick) {
		this.anchorNick = anchorNick;
	}

	public Long getMode() {
		return mode;
	}

	public void setMode(Long mode) {
		this.mode = mode;
	}

	public String getExtendsInfo() {
		return extendsInfo;
	}

	public void setExtendsInfo(String extendsInfo) {
		this.extendsInfo = extendsInfo;
	}

	public List<String> getImServer() {
		
		if(this.imServer == null)
			this.imServer = Arrays.asList(new String[]{Constants.IM_NEW});
		return imServer;
	}

	public void setImServer(List<String> imServer) {
		this.imServer = imServer;
	}

	public String getCoverUrl() {
		return coverUrl;
	}

	public void setCoverUrl(String coverUrl) {
		this.coverUrl = coverUrl;
	}

	public String getChatId() {
		return chatId;
	}

	public void setChatId(String chatId) {
		this.chatId = chatId;
	}

	public String getAnchorId() {
		return anchorId;
	}

	public void setAnchorId(String anchorId) {
		this.anchorId = anchorId;
	}

	public Date getStartedAt() {
		return startedAt;
	}

	public void setStartedAt(Date startedAt) {
		this.startedAt = startedAt;
	}

	public Date getStoppedAt() {
		return stoppedAt;
	}

	public void setStoppedAt(Date stoppedAt) {
		this.stoppedAt = stoppedAt;
	}

	public Integer getLikeAmount() {
		return likeAmount;
	}

	public void setLikeAmount(Integer likeAmount) {
		this.likeAmount = likeAmount;
	}

	public Integer getViewingIncre() {
		return viewingIncre;
	}

	public void setViewingIncre(Integer viewingIncre) {
		this.viewingIncre = viewingIncre;
	}

	public Integer getOnlineNum() {
		return onlineNum;
	}

	public void setOnlineNum(Integer onlineNum) {
		this.onlineNum = onlineNum;
	}

}
